id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

String OperationsSubstr1

prev  |  next  |  chance

The first character in a string is at index 0.

public static String slice(String s) {
    String c = s.substring(0, 1);
    return c;
}
Function Call  Return Value
slice("Car")
slice("Truck")
slice("55684")
slice("Elephant")
slice("Roses")

Experiment with this code on Gitpod.io

⬅ Back